<template>
    <div>
        <div class="center-bj">
            <span class="yys-box">
                <img class="yys-img" src="../../../static/img/jxs.png" alt="">
                <em class="yys-name">经销商</em>
            </span>
            <img class="yys-pic" :src="info.avatar" alt="">
            <span class="center-name">{{info.user_nickname}}</span>
        </div>
        <ul class="clearfix info-list dealers-info-ul b-g-f">
            <router-link tag="li" :to="{name:'code',query:{codeTitle:'dealers',imgPath:info.avatar}}" class="clearfix info-list-li dealers-info-li">
                <img class="info-li-img" src="../../../static/img/d-qrcode.png" alt="">
                <span class="hz-qrcode">邀请营养师二维码</span>
            </router-link>
            <router-link tag="li" :to="{name:'hospital'}" class="clearfix info-list-li dealers-info-li">
                <img class="info-li-img" src="../../../static/img/myHost.png" alt="">
                <span class="hz-qrcode">我的医院</span>
            </router-link>
        </ul>
        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
            <ul class="follow-hz clearfix b-g-f">
                <li class="follow-dian-box">
                    <img class="order-dian" src="../../../static/img/tuoyuan.png" alt="">
                    我的营养师
                </li>
                <router-link :to="{name:'orderlist',query:{id:item.id}}" tag="li" class="follow-hz-list clearfix" v-for="(item,index) in dealersList" :key="index">
                    <img class="follow-hz-img" :src="item.avatar" alt="">
                    <div class="follow-name-box">
                        <span class="follow-name">{{item.user_nickname}}</span>
                        <span class="follow-order-num">{{item.hospital_name}}</span>
                    </div>
                </router-link>
            </ul>
        </van-list>
    </div>
</template>
<script>
export default {
    data(){
        return{
            info:{},
            page:0,
            dealersList:[],
            loading:false,
            finished:false,
        }
    },
    mounted(){},
    methods:{
        onLoad(){
            this.dealersInfo()
        },
        // 经销商个人资料
        dealersInfo(){
            this.$api.shopping.userGetInfo().then(resp=>{
                if(resp.code == 1){
                    this.info = resp.data
                    this.myDietitianForAgent()
                }
            })
        },
        // 我的营养师列表
        myDietitianForAgent(){
            this.page++
            this.$api.dealers.myDietitianForAgent({page:this.page}).then(resp=>{
                if(resp.code == 1){
                    this.loading = false
                    if(resp.data.length > 0){
                        resp.data.forEach(e=>{
                            this.dealersList.push(e)
                        })
                    }else{
                        this.finished = true
                    }
                }
            })
        }
    }
}
</script>

<style lang="less" scoped>
.dealers-info-ul{
    margin: 30px 40px 0 40px;
    border-radius: 20px;
    padding: 0 20px;
    .dealers-info-li{
        padding-left: 10px;
        padding-right: 10px;
        margin-top: 0px;
        border-radius: 0;
        border-bottom: solid 2px #f5f5f5;
        background-position: center right;
    }
    .dealers-info-li:last-child{
        border-bottom: none;
    }
}
.dealers-info-b-no{
    background: none;
}
</style>

